const http = require('http')
const server1 = http.createServer((req, res) => {
  res.end('server1')
})
server1.listen(8000, () => {
  console.log('server1')
})
// const server2 = http.createServer((req, res) => {
//   res.end('server2')
// })
//  创建服务器的第二种方式
const server2 = new http.Server((req, res) => {
  res.end('server2')
})
server2.listen(() => {
  console.log('server2')
  console.log(server2.address().port)
})